import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'
const NavListKey = 'Nav-List'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getNavList() {
  const cookie = Cookies.get(NavListKey) || '[]'
  return JSON.parse(cookie)
}

export function setNavList(list) {
  return Cookies.set(NavListKey, JSON.stringify(list))
}

export function removeNavList() {
  return Cookies.remove(NavListKey)
}
